algalcommand.io
Class SimpleTime

java.lang.Object
  extended by algalcommand.io.SimpleTime

public class SimpleTime
extends java.lang.Object


Constructor Summary
SimpleTime()
           
SimpleTime(java.util.Calendar time)
          Creates an object from a calendar object
SimpleTime(java.util.Date time)
          Creates an object from a date object
SimpleTime(java.lang.String timestring)
          Creates an object frmo a time string
 
Method Summary
static SimpleTime currentTime()
           
 int getHours()
           
 int getMinutes()
           
 double getSeconds()
           
static void main(java.lang.String[] args)
           
static SimpleTime parseSimpleTime(java.lang.String time)
          makes a SimpleTime object from a String representing time
 void setHours(int t)
          Sets the hour time component
 void setMinutes(int t)
          Sets the minute time component
 void setSeconds(double t)
          Sets the second time component
 void setSeconds(int t)
          Sets the second time component
 void setTime(java.util.Calendar caldate)
          Sets the time from the given Calendar object.
 void setTime(java.util.Date date)
          Sets the time from the given date object.
 void setTime(java.lang.String timestring)
           
 double toDayFraction()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleTime

public SimpleTime()

SimpleTime

public SimpleTime(java.lang.String timestring)
Creates an object frmo a time string

Parameters:
timestring -

SimpleTime

public SimpleTime(java.util.Date time)
Creates an object from a date object

Parameters:
time -

SimpleTime

public SimpleTime(java.util.Calendar time)
Creates an object from a calendar object

Parameters:
time -
Method Detail

currentTime

public static SimpleTime currentTime()
Returns:
An instance of SimpleTime that corresponds to the system's current local time

setTime

public void setTime(java.lang.String timestring)
Parameters:
timestring - A string representing time, such as 8:30 or 1:56:09.5pm

setTime

public void setTime(java.util.Date date)
Sets the time from the given date object. Day, month, and year information are ignored

Parameters:
date -

setTime

public void setTime(java.util.Calendar caldate)
Sets the time from the given Calendar object. Day, month, and year information are ignored.

Parameters:
caldate -

getHours

public int getHours()
Returns:
The hour

getMinutes

public int getMinutes()
Returns:
The minute

getSeconds

public double getSeconds()
Returns:
The second

setHours

public void setHours(int t)
Sets the hour time component

Parameters:
t - New value

setMinutes

public void setMinutes(int t)
Sets the minute time component

Parameters:
t - New value

setSeconds

public void setSeconds(int t)
Sets the second time component

Parameters:
t - New value

setSeconds

public void setSeconds(double t)
Sets the second time component

Parameters:
t - New value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A string representing the time in 24hr format

toDayFraction

public double toDayFraction()
Returns:
A number between 0 and 1, where 0 is 0:00:00 and 1 is 24:00:00

parseSimpleTime

public static SimpleTime parseSimpleTime(java.lang.String time)
                                  throws java.lang.NumberFormatException
makes a SimpleTime object from a String representing time

Parameters:
time -
Returns:
Throws:
java.lang.NumberFormatException - Thrown if there are any poorly formed numbers

main

public static void main(java.lang.String[] args)